home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / strlib.zip / BMOVE.C < prev    next >
Text File  |  1993-01-04  |  1KB  |  44 lines

  1.  
  2. /*  File   : bmove.c
  3.     Author : Richard A. O'Keefe.
  4.     Updated: 23 April 1984
  5.     Defines: bmove()
  6.  
  7.     bmove(dst, src, len) moves exactly "len" bytes from the source "src"
  8.     to the destination "dst".  It does not check for NUL characters as
  9.     strncpy() and strnmov() do.  Thus if your C compiler doesn't support
  10.     structure assignment, you can simulate it with
  11.         bmove(&to, &from, sizeof from);
  12.     The standard 4.2bsd routine for this purpose is bcopy.  But as bcopy
  13.     has its first two arguments the other way around you may find this a
  14.     bit easier to get right.
  15.     No value is returned.
  16.  
  17.     Note: the "b" routines are there to exploit certain VAX order codes,
  18.     but the MOVC3 instruction will only move 65535 characters.   The asm
  19.     code is presented for your interest and amusement.
  20. */
  21.  
  22. #include "strings.h"
  23.  
  24. #if     VaxAsm
  25.  
  26. void bmove(dst, src, len)
  27.     char *dst, *src;
  28.     int len;
  29.     {
  30.         asm("movc3 12(ap),*8(ap),*4(ap)");
  31.     }
  32.  
  33. #else  ~VaxAsm
  34.  
  35. void bmove(dst, src, len)
  36.     register char *dst, *src;
  37.     register int len;
  38.     {
  39.         while (--len >= 0) *dst++ = *src++;
  40.     }
  41.  
  42. #endif  VaxAsm
  43.  
  44.